package la.iok.hzsvn.lewin.movie.model;

import java.util.Map;

public class ObsSignedUrl {
    /**
     * 签名url的id。在分段上传的时候验证分段命令是同一个文件，避免前端中途修改为上传其他文件
     */
    private String id;
    private String url;
    private Map<String,String> headers;
    private Boolean exist;
    /**
     * 文件id,前端不需要使用
     */
    private Long fileId;

    /**
     * 表示不存在的一个实例,此实例不支持修改
     */
    private static final ObsSignedUrl NOT_EXIST = new ObsSignedUrl(true){
        @Override
        public void setExist(Boolean exist) {

        }

        @Override
        public Boolean getExist() {
            return false;
        }

        @Override
        public void setFileId(Long fileId) {

        }

        @Override
        public void setHeaders(Map<String, String> headers) {

        }

        @Override
        public void setUrl(String url) {

        }
    };

    public static ObsSignedUrl notExist(){
        return NOT_EXIST;
    }

    public ObsSignedUrl() {
    }

    public ObsSignedUrl(Boolean exist) {
        this.exist = exist;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public Boolean getExist() {
        return exist;
    }

    public void setExist(Boolean exist) {
        this.exist = exist;
    }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    @Override
    public String toString() {
        return "ObsSignedUrl{" +
                "url='" + url + '\'' +
                ", headers=" + headers +
                ", exist=" + exist +
                ", fileId=" + fileId +
                '}';
    }
}
